<?php

namespace app\admin\model;

use think\Model;


class Yundan extends Model
{



    protected $table = 'whqy_yundan';

    // 表名
   // protected $name = 'yundan';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'daoshixian_text',
        'tihuoshixian_text',
    ];



    public function dingdan()
    {
        return $this->belongsTo('wl_dingdan','dingdan_id') ;
    }



    public function getDaoshixianTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['daoshixian']) ? $data['daoshixian'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }

   public function getTihuoshixianTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['tihuoshixian']) ? $data['tihuoshixian'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }



    protected function setDaoshixianAttr($value)
    {
        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
    }
    protected function setTihuoshixianAttr($value)
    {
        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
    }







}
